var selectedTab = 1;    // 选中的tab页，枚举值如下：1-【候选】tab页，2-【复诊】tab页，3-【已就诊】tab页
var _redPipePatients = STSUrl + "/QueuingOperate/redPretestStage";
var _yellowPipePatients = STSUrl + "/QueuingOperate/yellowPretestStage";
var _checkBack = STSUrl + "/QueuingOperate/checkBack";
//判断医生是否在线
var _doctorStatusUrl = CallNumberUrl + "/CallDevice/getDoctorLoginStatus";
//复诊时默认医生/可选医生
var getDoctorByQueueIdUrl = QueueCallUrl + "/QcQueue/getNotPageDoctorByQueueId";
var ajaxFirstDicUrl = SystemLimitUrl+'/dic/list';
var ajaxQxbdUrl = TriageUrl+'/QueuingOperate/cancelQueuing';
var _screenWidth = parseFloat($(window).width() / 3.5) + "px";
var _screenHeight = parseFloat($(window).height() - 65) + "px";
var ajaxCfgUrl =TriageUrl+'/Triage/getTriageConfigInfo';
$(function () {
   var isPre = localStorage.getItem('colorStatus')||'';
   if(isPre==1){
       // 没开预检
       $('.theme-blue').removeClass('isPre');
   }else {
       $('.theme-blue').addClass('isPre');
   }
});
function getTriageCfg() {
    $.ajax({
        url: ajaxCfgUrl,
        type: 'get',
        data: {
            triageId: unescape(getCookie("deviceId"))
        },
        success: function (d) {
            var res = JSON.parse(d)
            if (res.status == '0') {
                var gender =res.data.sexDefault;
                localStorage.setItem('gender',gender)
            } else {
                layer.alert(JSON.parse(d).desc, { icon: 2 });
            }
        }
    });
}
/***
 *  优先患者
 *  @param ids 队列排队id
 *  @param dicKey 优先的类型，关闭时传递 0
 *  @param index
 *
 * */
function firstPatient(ids,dicKey,index) {
    var hospitalId = getHospitalId();
    var loginId = getLoginUserId();
    $.ajax({
        url: _priorityPatients,
        type: "post",
        data: {
            id: ids,
            loginId: loginId,
            hospitalId: hospitalId,
            dicKey:dicKey
        },
        success: function (data) {
            showOperationResult(index, data);
        },
        error: function (jqXHR, textStatus, errorThrown) {
            layer.alert("操作失败!", { icon: 2 });
        }
    });
}
/**
 *  获取优先类型
 * **/
function getFirstDic() {
    //?dicType=1
    $.ajax({
        url: ajaxFirstDicUrl,
        type: 'get',
        data: {
            dicType: 2,
        },
        success: function (d) {
            var res = JSON.parse(d);
            if (res.status == '0') {
                localStorage.setItem('ym_dic',JSON.stringify(res.data));
            }
        }
    });
}

function autoResizeWindow() {

    let screenWidth = parseFloat($(window).width());
    let screenHeight = parseFloat($(window).height());


    if (screenWidth <= 1034) {

        $(".tabs").css({
            "width": "776px",
            "height": "78%",
            "overflow-x": "auto"
        })

        $("#table_hz").css({
            "width": "1480px",
            "overflow": "auto"
        });

        $("#table_fz").css({
            "width": "1480px",
            "overflow": "auto"
        });

        $("#table_yjz").css({
            "width": "1480px",
            "overflow": "auto"
        });


    }
    else if (screenWidth >= 1340 && screenWidth <= 1360) {



        $(".tabs").css({
            "width": "1030px",
            "height": "78%",
            "overflow-x": "auto"
        })

        $("#table_hz").css({
            "width": "1480px",
            "overflow": "auto"
        });

        $("#table_fz").css({
            "width": "1480px",
            "overflow": "auto"
        });

        $("#table_yjz").css({
            "width": "1480px",
            "overflow": "auto"
        });

    }
    else {

        $(".tabs").css({
            "width": "100%",
            "height": "78%",
            "overflow-x": "auto"
        })

        $("#table_hz").css({
            "width": "100%",
            "overflow": "auto"
        });

        $("#table_fz").css({
            "width": "100%",
            "overflow": "auto"
        });

        $("#table_yjz").css({
            "width": "100%",
            "overflow": "auto"
        });

    }

}


function reloadToolBarFontSize() {

    // 获取 html 元素
    var tooBar = $(".model_info_optool");

    window.onresize = function () {
        var hW = $(tooBar).offsetWidth;
        var hS = hW / 50;
        tooBar.css('font-size', hS + "px");

        autoResizeWindow();
        refreshTab();
    }

}


function ReadCardInfo_CallBack() {
    //⑬　获得身份证号码：
    // my_cefsharp.Get_People_ID_Cef(ReadCardInfo);
    //⑭　获得卡的UID号：
    my_cefsharp.Get_Card_UID_Cef(ReadCardInfo);

}

function ReadCardInfo(_patientKey) {
    if(_patientKey=='00000000')  _patientKey = '';
    layer.open({
        type: 2,
        title: "现场报到",
        shadeClose: true,
        closeBtn: 1,
        area: ['400px', '365px'],
        content: '../window/livecoverage_win.html?_patientKey=' + _patientKey,
        //content: '../window/auto_checkin.html?idnumber=' + v,
    });
}


//预加载第一个标签内容
function loadfst() {
    $('#mytab a:first').tab('show');
    selectedTab = 1;
    //测试
    // loadYjzDataGrid("");
}

// 获取列表中选中的患者id
function getSelectedPatients() {
    var ids = new Array();
    if (selectedTab == 1) {
        $("#t_table_hz_content :radio").each(function (key, value) {
            if ($(value).prop('checked')) {
                var content = $(this).attr("id");
                ids.push(content);
            }
        })
    } else if (selectedTab == 2) {
        $("#t_table_fz_content :radio").each(function (key, value) {
            if ($(value).prop('checked')) {
                var content = $(this).attr("id");
                ids.push(content);
            }
        })
    } else if (selectedTab == 3) {
        $("#t_table_yjz_content :radio").each(function (key, value) {
            if ($(value).prop('checked')) {
                var content = $(this).attr("id");
                ids.push(content);
            }
        })
    }
    return ids.join(',');
}
// 获取列表中选中的患者预检状态
function getColorStatus() {
    var pretestStageStatus = "";
    //var  pretestStage = "";
    var colorStatusDefault = localStorage["colorStatus"];
    if (selectedTab == 3) {
        $("#t_table_yjz_content :radio").each(function (key, value) {
            if ($(value).prop('checked')) {
                if (colorStatusDefault == 1) {
                    pretestStageStatus = $(this).attr("data-color_status");
                } else {
                    pretestStageStatus = 3;
                }
            }
        })
    } else if (selectedTab == 2) {
        $("#t_table_fz_content :radio").each(function (key, value) {
            if ($(value).prop('checked')) {
                if (colorStatusDefault == 1) {
                    pretestStageStatus = $(this).attr("data-color_status");
                } else {
                    pretestStageStatus = 3;
                }
            }
        })
    }
    if (colorStatusDefault == 0) {
        pretestStageStatus = 3;
    }
    return pretestStageStatus;
}
// 获取列表中选中的患者队列id
function getyjzQueueId() {
    var queueId = "";
    if (selectedTab == 3) {
        $("#t_table_yjz_content :radio").each(function (key, value) {
            if ($(value).prop('checked')) {
                queueId = $(this).attr("data-queueId");
            }
        })
    }
    return queueId;
}
// 获取列表中选中的患者key
function getyjzPatientKey() {
    var patientKey = "";
    if (selectedTab == 3) {
        $("#t_table_yjz_content :radio").each(function (key, value) {
            if ($(value).prop('checked')) {
                patientKey = $(this).attr("data-patientKey");
            }
        })
    }
    return patientKey;
}
// 获取列表中选中的患者队列Key
function getyjzQueueKey() {
    var queueKey = "";
    if (selectedTab == 3) {
        $("#t_table_yjz_content :radio").each(function (key, value) {
            if ($(value).prop('checked')) {
                queueKey = $(this).attr("data-queueKey");
            }
        })
    }
    return queueKey;
}
// 获取列表中选中的患者医生id
function getyjzDoctorId() {
    var doctorId = "";
    if (selectedTab == 3) {
        $("#t_table_yjz_content :radio").each(function (key, value) {
            if ($(value).prop('checked')) {
                doctorId = $(this).attr("data-doctorId");
            }
        })
    }
    return doctorId;
}
// 获取列表中选中的患者队列Key
function getyjzDoctorName() {
    var doctorIdName = "";
    if (selectedTab == 3) {
        $("#t_table_yjz_content :radio").each(function (key, value) {
            if ($(value).prop('checked')) {
                doctorIdName = $(this).attr("data-doctorName");
            }
        })
    }
    return doctorIdName;
}
// 刷新tab页面
var mLoadFlg = null;

// 显示操作结果
function showOperationResult(index, data) {
    var result = JSON.parse(data);
    if (result.status == 0) {
        layer.close(index);
        layer.alert("操作成功!", { icon: 1 });
        refreshTab();//刷新当前页面.
    } else {
        layer.close(index);
        layer.alert(result.desc, { icon: 2 });
    }
}

// 复位button的状态
function resetButtonStatus() {
    /*$("#but_yx").attr('disabled',"disabled");
    $("#but_qxyx").attr('disabled',"disabled");*/
    setButtonsEnable($("#but_yx"), false, $("#but_qxyx"), false);
    $("#but_fenz").attr('disabled', "disabled");
    $("#but_zz").attr('disabled', "disabled");
    /*$("#but_gq").attr('disabled',"disabled");
    $("#but_qxgq").attr('disabled',"disabled");
    $("#but_ys").attr('disabled',"disabled");
    $("#but_qxys").attr('disabled',"disabled");*/
    $("#but_gb").attr('disabled', "disabled");
    setButtonsEnable($("#but_gq"), false, $("#but_qxgq"), false);
    setButtonsEnable($("#but_ys"), false, $("#but_qxys"), false);
    $("#but_lstd").attr('disabled', "disabled");
    $("#but_ghzg").attr('disabled', "disabled");
    $("#but_fuz").attr('disabled', "disabled");
    refreshColorButtons();
    $("#but_p_up").attr('disabled', "disabled");
    $("#but_p_down").attr('disabled', "disabled");
    $("#but_to_cancel").attr('disabled', "disabled");
    //$("#but_input").prop("disabled", false).css({ "background-color": "#19ABFE" });
    //$("#but_edit").prop("disabled", false).css({ "background-color": "#19ABFE" });
}

var g_data_singId = null;
// 根据选中行的状态，设置的可选状态
function setButtonStatus(_this) {
    var treate_status = $(_this).attr("data-treate_status"); //分诊状态
    var wait_status = $(_this).attr("data-wait_status"); //候诊状态
    var treate_stage_status = $(_this).attr("data-treate_stage_status"); //就诊阶段
    var treate_end_status = $(_this).attr("data-treate_end_status"); //已就诊状态
    var recall_status = $(_this).attr("data-recall_status"); //过号召回状态
    var green_status = $(_this).attr("data-green_status"); //绿色通道状态
    var color_status = $(_this).attr("data-color_status"); //预检状态
    $("#but_to_cancel").removeAttr('disabled');//不管啥状态都允许取消报到
    g_data_singId = $(_this).attr("data-signId");
    if (selectedTab == 1 || selectedTab == 2) {
        $("#but_p_up").removeAttr('disabled');
        $("#but_p_down").removeAttr('disabled');
        if (treate_stage_status == 1) {
            if (wait_status == 0) {
                /*$("#but_yx").removeAttr("disabled");
                $("#but_qxyx").attr('disabled',"disabled");*/
                setButtonsEnable($("#but_yx"), true, $("#but_qxyx"), false);
                $("#but_fenz").attr('disabled', "disabled");
                $("#but_zz").removeAttr("disabled");
                /*$("#but_gq").removeAttr("disabled");
                $("#but_qxgq").attr('disabled',"disabled");*/
                setButtonsEnable($("#but_gq"), true, $("#but_qxgq"), false);
                /*$("#but_ys").removeAttr("disabled");
                $("#but_qxys").attr('disabled',"disabled");*/
                setButtonsEnable($("#but_ys"), true, $("#but_qxys"), false);
                $("#but_gb").removeAttr("disabled");
                $("#but_lstd").removeAttr("disabled");
                $("#but_ghzg").attr('disabled', "disabled");
                $("#but_fuz").attr('disabled', "disabled");
            } else if (wait_status == 1) {
                /*$("#but_yx").attr('disabled',"disabled");
                $("#but_qxyx").removeAttr("disabled");*/
                setButtonsEnable($("#but_yx"), false, $("#but_qxyx"), true);
                $("#but_fenz").attr('disabled', "disabled");
                $("#but_zz").attr('disabled', "disabled");
                /*$("#but_gq").attr('disabled',"disabled");
                $("#but_qxgq").attr('disabled',"disabled");*/
                setButtonsEnable($("#but_gq"), false, $("#but_qxgq"), false);
                /*$("#but_ys").attr('disabled',"disabled");
                $("#but_qxys").attr('disabled',"disabled");*/
                setButtonsEnable($("#but_ys"), false, $("#but_qxys"), false);
                $("#but_gb").removeAttr("disabled");
                $("#but_lstd").removeAttr("disabled");
                $("#but_ghzg").attr('disabled', "disabled");
                $("#but_fuz").attr('disabled', "disabled");
            } else if (wait_status == 2) {
                /*$("#but_yx").attr('disabled',"disabled");
                $("#but_qxyx").attr('disabled',"disabled");*/
                setButtonsEnable($("#but_yx"), false, $("#but_qxyx"), false);
                $("#but_fenz").attr('disabled', "disabled");
                $("#but_zz").attr('disabled', "disabled");
                /*$("#but_gq").attr('disabled',"disabled");
                $("#but_qxgq").removeAttr("disabled");
                $("#but_ys").attr('disabled',"disabled");
                $("#but_qxys").attr('disabled',"disabled");*/
                setButtonsEnable($("#but_gq"), false, $("#but_qxgq"), true);
                setButtonsEnable($("#but_ys"), false, $("#but_qxys"), false);

                $("#but_gb").removeAttr("disabled");
                $("#but_lstd").removeAttr("disabled");
                $("#but_ghzg").attr('disabled', "disabled");
                $("#but_fuz").attr('disabled', "disabled");
            } else if (wait_status == 3) {
                /*$("#but_yx").attr('disabled',"disabled");
                $("#but_qxyx").attr('disabled',"disabled");*/
                setButtonsEnable($("#but_yx"), false, $("#but_qxyx"), false);
                $("#but_fenz").attr('disabled', "disabled");
                $("#but_zz").attr('disabled', "disabled");
                /*$("#but_gq").attr('disabled',"disabled");
                $("#but_qxgq").attr('disabled',"disabled");
                $("#but_ys").attr('disabled',"disabled");
                $("#but_qxys").removeAttr("disabled");*/
                setButtonsEnable($("#but_gq"), false, $("#but_qxgq"), false);
                setButtonsEnable($("#but_ys"), false, $("#but_qxys"), true);
                $("#but_gb").removeAttr("disabled");
                $("#but_lstd").removeAttr("disabled");
                $("#but_ghzg").attr('disabled', "disabled");
                $("#but_fuz").attr('disabled', "disabled");
            }
        } else if (treate_stage_status == 2) {
            /*$("#but_yx").attr('disabled',"disabled");
            $("#but_qxyx").attr('disabled',"disabled");*/
            setButtonsEnable($("#but_yx"), false, $("#but_qxyx"), false);
            $("#but_fenz").attr('disabled', "disabled");
            $("#but_zz").removeAttr("disabled");
            /*$("#but_gq").attr('disabled',"disabled");
            $("#but_qxgq").attr('disabled',"disabled");
            $("#but_ys").attr('disabled',"disabled");
            $("#but_qxys").attr('disabled',"disabled");*/
            setButtonsEnable($("#but_gq"), false, $("#but_qxgq"), false);
            setButtonsEnable($("#but_ys"), false, $("#but_qxys"), false);
            $("#but_gb").attr('disabled', "disabled");
            $("#but_lstd").removeAttr("disabled");
            $("#but_ghzg").attr('disabled', "disabled");
        }

        /*        if (treate_status == 1){
                    $("#but_fuz").removeAttr("disabled");
                }else{
                    $("#but_fuz").attr('disabled',"disabled");
                }*/
    } else if (selectedTab == 3) {
        /*$("#but_yx").attr('disabled',"disabled");
        $("#but_qxyx").attr('disabled',"disabled");*/
        setButtonsEnable($("#but_yx"), false, $("#but_qxyx"), false);
        $("#but_fenz").attr('disabled', "disabled");
        $("#but_zz").attr('disabled', "disabled");
        /*$("#but_gq").attr('disabled',"disabled");
        $("#but_qxgq").attr('disabled',"disabled");
        $("#but_ys").attr('disabled',"disabled");
        $("#but_qxys").attr('disabled',"disabled");*/
        setButtonsEnable($("#but_gq"), false, $("#but_qxgq"), false);
        setButtonsEnable($("#but_ys"), false, $("#but_qxys"), false);
        $("#but_lstd").attr('disabled', "disabled");
        $("#but_gb").removeAttr("disabled");
        $("#but_fuz").attr('disabled', "disabled");
        $("#but_ghzg").attr('disabled', "disabled");

        if (treate_stage_status == 3) {

        } else if (treate_stage_status == 4) {
            if (treate_end_status == 1) {
                $("#but_fuz").removeAttr("disabled");
            } else if (treate_end_status == 2) {
                $("#but_ghzg").removeAttr("disabled", "disabled");
            } else if (treate_end_status == 3) {
                $("#but_fuz").removeAttr("disabled");
            }
        }
    }

    if (treate_end_status == -1) {// 处于候诊阶段
        if (color_status == 1) { // 患者处于红色优先级，“优先”，“取消优先”，“挂起”，“取消挂起”，“延时”，“取消延时”，“转诊”，“分诊”按钮都不能操作。并且“预检颜色块”也不能点击
            setButtonsEnable($("#but_yx"), false, $("#but_qxyx"), false);
            setButtonsEnable($("#but_gq"), false, $("#but_qxgq"), false);
            setButtonsEnable($("#but_ys"), false, $("#but_qxyx"), false);
            $("#but_fenz").attr('disabled', "disabled");
            $("#but_zz").attr('disabled', "disabled");

            $("#but_red").attr('disabled', "disabled");
            $("#but_yellow").attr('disabled', "disabled");
            $("#but_green").attr('disabled', "disabled");
        } else if (color_status == 2) {// 患者处于黄色优先级
            if (treate_stage_status == 1) {  // 患者“就诊阶段”处于“候诊状态”，允许点击“预检颜色块”的“红色”
                $("#but_red").removeAttr("disabled");
            } else {
                $("#but_red").attr('disabled', "disabled");
            }
            // "预检颜色块"的 黄色，绿色不允许点击
            $("#but_yellow").attr('disabled', "disabled");
            $("#but_green").attr('disabled', "disabled");

            // “优先”，“取消优先”，“挂起”，“取消挂起”，“延时”，“取消延时”，“转诊”，“分诊”按钮都不能操作
            setButtonsEnable($("#but_yx"), false, $("#but_qxyx"), false);
            setButtonsEnable($("#but_gq"), false, $("#but_qxgq"), false);
            setButtonsEnable($("#but_ys"), false, $("#but_qxyx"), false);
            $("#but_fenz").attr('disabled', "disabled");
            $("#but_zz").attr('disabled', "disabled");
        } else if (color_status == 3) {
            if (treate_stage_status == 1) { // 处于候诊阶段，“红色”，“黄色”允许点击

                $("#but_red").removeAttr("disabled");
                $("#but_yellow").removeAttr("disabled");
            } else { // 非候诊阶段，“预检颜色块”都不能点击
                $("#but_red").attr('disabled', "disabled");
                $("#but_yellow").attr('disabled', "disabled");
            }
            $("#but_green").attr('disabled', "disabled");
            //处于优先/挂起/延时状态，红黄按钮不可点击
            if (wait_status == 1 || wait_status == 2 || wait_status == 3) {
                $("#but_red").attr('disabled', "disabled");
                $("#but_yellow").attr('disabled', "disabled");
            }
        }
    } else {  // 已就诊列表，预检颜色块不能点击
        $("#but_red").attr('disabled', "disabled");
        $("#but_yellow").attr('disabled', "disabled");
        $("#but_green").attr('disabled', "disabled");
        if ((showColorButtons() == 1) && (color_status == 1)) { // 处于“红色”状态患者，“复诊”按钮不能点击
            $("#but_fuz").attr('disabled', "disabled");
        } else {
            $("#but_fuz").removeAttr("disabled");
        }
    }


    //if (data_singId == 'null' || data_singId == null) {

    //    $("#but_input").prop("disabled", false).css({ "background-color": "#19ABFE" });
    //    $("#but_edit").prop("disabled", false).css({ "background-color": "#19ABFE" });
    //} else {

    //    $("#but_input").prop("disabled", true).css({ "background-color": "#cccccc" });
    //    $("#but_edit").prop("disabled", true).css({ "background-color": "#cccccc" });

    //}


}

// 设置按钮是否可用，已经按钮是否显示
// opButton: 操作按钮
// opEnable: 操作按钮是否可用
// qxOpButton: 取消操作按钮
// qxOpEnable: 取消操作是否可用
function setButtonsEnable(opButton, opEnable, qxOpButton, qxOpEnable) {
    if (opEnable == qxOpEnable) {
        opButton.attr('disabled', "disabled");
        qxOpButton.attr('disabled', "disabled");

        opButton.show();
        qxOpButton.hide();
        /*        opButton.style.display = "block";
                qxOpButton.style.display = "none";*/
    } else {
        if (opEnable) {
            opButton.removeAttr("disabled");
            qxOpButton.attr('disabled', "disabled");

            opButton.show();
            qxOpButton.hide();
            /*opButton.style.display = "block";
            qxOpButton.style.display = "none";*/
        } else {
            opButton.attr('disabled', "disabled");
            qxOpButton.removeAttr("disabled");

            opButton.hide();
            qxOpButton.show();
            /*opButton.style.display = "none";
            qxOpButton.style.display = "block";*/
        }
    }
}


// 对延迟时间做操作
function getDelayDetailTime(delayEditTime, delayMinutes) {
    if (delayEditTime == null || delayEditTime == "") {
        return "";
    }

    if (delayMinutes == null || delayMinutes == "" || (delayEditTime + "" == "0")) {
        return "";
    }

    var strTime = delayEditTime.replace(/-/g, "/");
    var date = new Date(strTime);
    var time = date.valueOf();
    time = time + delayMinutes * 60 * 1000;
    var newTime = new Date(time);

    /*
    // delayEditTime 的格式是 yyyyMMddhhmmss
    var year = delayEditTime.substring(0, 4);
    var month = delayEditTime.substring(4, 6);
    var day = delayEditTime.substring(6, 8);
    var hour = delayEditTime.substring(8, 10);
    var minutes = delayEditTime.substring(10, 12);
    var second = delayEditTime.substring(12, 14);
    var editTime = new Date(year, month - 1, day, hour, minutes, second);
    var time = editTime.valueOf();
    time = time + delayMinutes * 60 * 1000;
    var newTime = new Date(time);
    */

    var newYear = newTime.getFullYear() + "";
    var newMonth = fixWidth(newTime.getMonth() + 1);
    var newDay = fixWidth(newTime.getDate());
    var newHour = fixWidth(newTime.getHours());
    var newMinutes = fixWidth(newTime.getMinutes());
    var newSecond = fixWidth(newTime.getSeconds());

    return newYear + "-" + newMonth + "-" + newDay + " " + newHour + ":" + newMinutes + ":" + newSecond;
}

// 使用0补齐2位的宽度
function fixWidth(value) {
    if (value < 10)
        return "0" + value;
    else
        return value + "";
}

/**
 * 刷新页面“绿色通道”按钮是否显示
 */
function refreshGreenChannelButton(_greenChannel) {
    if (_greenChannel == "1") {
        $("#but_lstd").show();
    } else {
        $("#but_lstd").hide();
    }
}

/**
 * 刷新页面“预检颜色”按钮是否显示
 */
function refreshColorButtons() {
    if (showColorButtons()) {
        resetColorButtons();
        $("#color_buttons").show();
    } else {
        $("#color_buttons").hide();
    }
}

/**
 * 重置“预检颜色”按钮的状态，默认“不可点击”
 */
function resetColorButtons() {
    $("#but_red").attr('disabled', "disabled");
    $("#but_yellow").attr('disabled', "disabled");
    $("#but_green").attr('disabled', "disabled");
}
//患者复诊选择初诊时的医生，该医生在线时显示初诊医生，不在线时显示全部
function doctorNameInfo() {
    // var deptId = parent.$("#select_call_systemType option:selected").attr("data-deptId"); // 父页面的科室id
    var deptId = allOrSingleDeptId();
    var hospitalId = getHospitalId();
    var queueId = getyjzQueueId();
    var patientKey = getyjzPatientKey();
    var doctorInfo = {};
    doctorInfo.id = "";
    doctorInfo.name = "";
    doctorInfo.status = "";
    $.ajax({
        url: getDoctorByQueueIdUrl,
        data: {
            deptId: deptId,
            hospitalId: hospitalId,
            queueId: queueId,
            patientKey: patientKey
        },
        type: 'get',
        async: false,
        beforeSend: function () {
            layer.msg('查询中...', { time: 1000 });
        },
        complete: function () {
            // layer.closeAll();
        },
        success: function (d) {
            if (JSON.parse(d).status == '0') {
                var dataInfo = JSON.parse(d).data;
                var lengthList = dataInfo.length;
                for (var i = 0; i < lengthList; i++) {
                    var _doctorId = dataInfo[i].doctorId;
                    var _doctorName = dataInfo[i].doctorName;
                    var _loginStatus = dataInfo[i].loginStatus;//初诊医生展示字段  0：在线 1：暂停  2：离线
                    if (_loginStatus == 1 || _loginStatus == 0 || _loginStatus == 2) {
                        doctorInfo.id = _doctorId;
                        doctorInfo.name = _doctorName;
                        doctorInfo.status = _loginStatus;
                    }

                }
            }
        }
    });
    return doctorInfo;
}
//c端调b端方法，传患者就诊卡号，候诊页面将值传给弹窗
function Read_Batch_Card_Info_tmt_nurse(patientKey) {
    var frameId = document.getElementById("bulkPageTmt").getElementsByTagName('iframe')[0].id;
    $('#' + frameId)[0].contentWindow.passCardToBatch(patientKey);
}






